package shop.services.manage.offline.dao.impl;

import org.springframework.stereotype.Repository;
import shop.core.common.dao.BaseDao;
import shop.core.common.dao.page.PagerModel;
import shop.services.manage.offline.bean.Offline;
import shop.services.manage.offline.dao.OfflineDao;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/4/15.
 */
@Repository("offlineDaoManage")
public class OfflineDaoImpl implements OfflineDao {
    @Resource
    private BaseDao dao;

    public void setDao(BaseDao dao) {
        this.dao = dao;
    }

    public PagerModel selectPageList(Offline e) {
        return dao.selectPageList("manage.offline.selectPageList",
                "manage.offline.selectPageCount", e);
    }

    public List selectList(Offline e) {
        return dao.selectList("manage.offline.selectList", e);
    }

    public Offline selectOne(Offline e) {
        return (Offline) dao.selectOne("manage.offline.selectOne", e);
    }

    public int delete(Offline e) {
        return dao.delete("manage.offline.deleteById", e);
    }

    public int update(Offline e) {
        return dao.update("manage.offline.update", e);
    }

    public int deletes(String[] ids) {
        Offline e = new Offline();
        for (int i = 0; i < ids.length; i++) {
            e.setId(ids[i]);
            delete(e);
        }
        return 0;
    }

    public int insert(Offline e) {
        return dao.insert("manage.offline.insert", e);
    }

    public int deleteById(int id) {
        return dao.delete("manage.offline.deleteById", id);
    }

    @Override
    public Offline selectById(String id) {
        return (Offline) dao.selectOne("manage.offline.selectById", id);
    }

}
